package controller;

import com.jfinal.core.Controller;

import model.User;
import service.LoginService;

public class LoginController extends Controller{

	public void index() {
		//String callback = getRequest().getParameter("callback"); 
		LoginService loginService = new LoginService();
	    User user = getModel(User.class);
	    user = loginService.checkUser(user.getUsername(), user.getPassword());
		renderJson(user);
	}
	
	public void register() {
		User user = getModel(User.class);
		if(user.save()) {
			renderJson("{\"status\":\"success\"}" );
		}else {
			renderJson("{\"status\":\"no\"}" );
		}
	}
}
